public class complex {
    public int x;
    public int y;
    complex(){
        this.x = 0;
        this.y = 0;
    }
    complex(int x,int y){
        this.x = x;
        this.y = y;
    }
    public void showComp(){
        if(this.y == 0) {
            System.out.println(this.x);
        }else if(this.y > 0){
            System.out.println(this.x + "+" + this.y + "i");
        }else if(this.y < 0){
            System.out.println(this.x + "" + this.y + "i");
        }
    }
    public complex addComp(complex com){
        complex tmp = new complex();
        tmp.x = this.x + com.x;
        tmp.y = this.y + com.y;
        return tmp;
    }
    public static complex subComp(complex com1,complex com2){
        complex tmp = new complex();
        tmp.x = com1.x - com2.x;
        tmp.y = com1.y - com2.y;
        return tmp;
    }
    public complex multiComp(complex com){
        complex tmp = new complex();
        tmp.x = this.x * com.x - this.y * com.y;
        tmp.y = this.x * com.y + this.y * com.x;
        return tmp;
    }
    public boolean equalComp(complex com){
        if(this.x != com.x){
            return false;
        }
        if(this.y != com.y){
            return false;
        }
        return true;
    }
}
